Skip to content

Conversation

@LecrisUT
Copy link
Collaborator

Fixes #2924

RELEASE NOTES BEGIN

Testing farm jobs running against dist-git PRs now have the dist-git-branch context pointing to the target branch
of the PR.

RELEASE NOTES END

@LecrisUT LecrisUT requested a review from a team as a code owner January 12, 2026 10:47
@LecrisUT LecrisUT requested review from lbarcziova and removed request for a team January 12, 2026 10:47
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request correctly adds the dist-git-branch context to Testing Farm jobs. However, I've identified a performance issue where fetching pull request details can result in redundant network requests. I've provided a suggestion to cache the pull request object, which will improve efficiency by ensuring the data is fetched only once per job run.

# this has to be specified at the api request level.
# TODO: Revisit when 0.2 testing-farm API is decided
os_params = {"os": {"compose": compose}} if compose else {}
dist_git_branch = self.project.get_pr(self.metadata.pr_id).target_branch
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This call to self.project.get_pr(self.metadata.pr_id) makes a network request. Since _get_tf_base_payload can be called multiple times within a single job run (e.g., for rpminspect and custom tests), this can lead to redundant API calls.

To improve efficiency, I suggest caching the pull request object on the helper instance. This ensures the PR is fetched only once per job run.

I've also noticed that _payload_custom makes a similar call. After applying this suggestion, you could refactor it to use the cached self._pr_object as well.

        if not hasattr(self, "_pr_object"):
            self._pr_object = self.project.get_pr(self.metadata.pr_id)
        dist_git_branch = self._pr_object.target_branch

@centosinfra-prod-github-app
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

distro context for epel10/epel10.X are not distinguishable

1 participant